import QtQuick
import QtQuick.Controls
import QtQuick.Layouts

Item {
    id: warning_WindowBack
    width: 1820
    height: 980

    // Rectangle{
    //     anchors.fill: parent
    //     color: "gold"

    //     Text{
    //         anchors.centerIn: parent
    //         font.pixelSize: 50
    //         font.bold: true
    //         text: qsTr("报警界面")
    //     }
    // }

    property int warning_CurrentPage: 1

    Component.onCompleted: {
        warningLoader.source = "Warning_Current.qml"
    }

    Row{
        anchors.top: warning_WindowBack.top
        anchors.topMargin: 10
        anchors.left: warning_WindowBack.left
        anchors.leftMargin: 10
        spacing: 10

        A_Button{
            buttonWidth: 120
            buttonHeight: 50
            contentText_Data: qsTr("输入信号")
            isSelected: warning_CurrentPage === 1
            onButtonClicked: {
                warning_CurrentPage = 1
                warningLoader.source = "Warning_Current.qml"
            }
        }

        A_Button{
            buttonWidth: 120
            buttonHeight: 50
            contentText_Data: qsTr("输出信号")
            isSelected: warning_CurrentPage === 2
            onButtonClicked: {
                warning_CurrentPage = 2
                warningLoader.source = "Warning_History.qml"
            }
        }
        A_Button{
            buttonWidth: 120
            buttonHeight: 50
            contentText_Data: qsTr("清除报警")
            // isSelected: warning_CurrentPage === 3
            // onButtonClicked: {
            //     warning_CurrentPage = 3
            //     ioMonitorLoader.source = "IO_Monitor_OutputSignals.qml"
            // }
        }

    }


    Loader{
        id: warningLoader
        anchors.top: warning_WindowBack.top
        anchors.topMargin: 70
        anchors.left: warning_WindowBack.left
        // anchors.leftMargin: 95
        onSourceChanged: {
            console.log("已加载: "+ source)
        }
    }


}
